package scala.test_feature.test_object

/**
 * @author 黄海峰 2021/4/15 13:26
 * */
object DeanTest {
  def main(args: Array[String]): Unit = {
    // class 实例
    val greeter = new Greeter("Hello", "!")
    greeter.greet("dean")

    // case class 实例
    val point = Point(1, 2)
    val twoPoint = Point(1, 2)
    val threePoint = Point(1, 2)
    val fourPoint = Point(2, 2)

    if (point == twoPoint) {
      println(point + " and " + twoPoint + "are the same")
    }

    if (twoPoint == threePoint) {
      println(twoPoint + " and " + threePoint + "are the same")
    }

    if (fourPoint != threePoint) {
      println(fourPoint + " and " + threePoint + "are not same")
    }

    // 单例的object
    val newId: Int = IdFactory.create()
    println(newId)
    val newId2: Int = IdFactory.create()
    println(newId2)

  }
}
